home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 15 / 015.d81 / comal tutor #3 (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1985-01-01  |  17.8 KB  |  453 lines

  1. 8 pokev+33,1:q$=chr$(34):vt$="":dimvt$(25)
  2. 9 fori=.to25:vt$(i)=left$(vt$,i+1):next:vt$=""
  3. 10 r=53265:c=128:v=53248:s=v+1024:li=52016:wi=51200:cl=51203:su=51206:sd=51209
  4. 12 pokes+23,.:pokes+4,128
  5. 15 gosub1000:print"   [215]elcome to this third installment"
  6. 16 print"of [204]oadstar's [195][207][205][193][204][160]0.14 [212]utorial.  [201]n
  7. 17 [153]"the first installment, you entered and
  8. 18 print"ran a short [195][207][205][193][204][160]program to convert
  9. 19 [153]"degrees ascarenheit into degrees lenelsius
  10. 20 print"and in the second you learned how it
  11. 21 [153]"worked.  (NULL)ow, we will learn some new
  12. 22 print"[195][207][205][193][204][160]commands that will let us store"
  13. 23 print"our programs onto our disk drives and"
  14. 24 print"recall them back into our [195]64's "
  15. 25 print"memory.":s%=-1:gosub1200
  16. 26 print"   [215]e want to make sure our program is
  17. 27 [153]"just as we left it.  (NULL)right$(NULL)(NULL)closethe program
  18. 28 print"to be sure it is still there:
  19. 30 [141]1160:[141]1300:x%[178].:y%[178]16:a$[178]"(NULL)right$(NULL)(NULL)":[141]1600
  20. 31 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]31
  21. 32 x%[178]4:y%[178]16:[141]1500:[139]k$[179][177][199](13)[167]32
  22. 33 [153]:[153]"0010 right$(NULL)(NULL)(NULL)(NULL) "q$"str$valchr$(NULL)valval(NULL) asc? "q$": ascatn(NULL)val(NULL)left$valright$(NULL)
  23. 34 print"0020 [195][197][204][211][201][213][211]:=([198][193][210][197][206][200][197][201][212]-32)*(5/9)
  24. 35 [153]"0030 (NULL)(NULL)right$(NULL)(NULL) ascatn(NULL)val(NULL)left$valright$(NULL);"q$"asc ="q$";lenval(NULL)(NULL)right$(NULL)(NULL);"q$"len"q$"":[141]1035
  25. 36 [141]1150:[153]"stop   (NULL)ep, still there!  mid$ust for "
  26. 37 [153]"practice, (NULL)(NULL)(NULL)closethe program and find out"
  27. 38 [153]"how many degrees lenelsius 100 degrees "
  28. 39 [153]"ascarenheit converts into:
  29. 40 gosub1160:x%=.:y%=21:a$="[210][213][206]":gosub1600
  30. 41 ifethena$=mid$(a$,e):e=.:gosub1605:goto41
  31. 42 x%=3:y%=21:gosub1500:ifk$<>chr$(13)then42
  32. 43 print:print"[196][197][199][210][197][197][211] [198]? ";:
  33. 45 x%=11:y%=22:a$="100":gosub1600
  34. 46 ifethena$=mid$(a$,e):e=.:gosub1605:goto46
  35. 47 x%=14:y%=22
  36. 48 gosub1500:ifk$<>chr$(13)then48
  37. 49 print:print"100 [198] = 37.7777778 [195]":gosub1700:print"[197][206][196][160][193][212][160]0030";:gosub1700:gosub1700
  38. 50 gosub1035:gosub1150:print"[144][146]   [217]ep!  [201]t's been getting around
  39. 51 [153]"37.7777778 len down here in (NULL)ousiana.":[141]1205
  40. 55 [153]"   (NULL)ow right$'m sure you have turned your
  41. 56 print"computer off a time or two since we
  42. 57 [153]"'wrote' this program 2 months ago!  right$n
  43. 58 print"real life, our program would be gone
  44. 59 [153]"since turning off the computer erases
  45. 60 print"it's memory!
  46. 61 [153]"   (NULL)e need a way to keep our programs,
  47. 62 print"even when we turn our computer off.
  48. 63 [153]"(NULL)hat, of course, is why you spent a
  49. 64 print"couple of hundred dollars or so on
  50. 65 [153]"that disk drive you've got!":[141]1200
  51. 70 :
  52. 71 :
  53. 72 :
  54. 73 :
  55. 74 :
  56. 75 :
  57. 76 :
  58. 77 :
  59. 78 :
  60. 79 :
  61. 80 [153]"   ascirst off, you need to know a few
  62. 81 print"things.  [193] single floppy disk can hold
  63. 82 [153]"144 'files' or 168,656 'bytes' of "
  64. 83 [153]"data, whichever comes first.  atn 'byte'
  65. 84 print"is equivalent to a character:  i.e. a
  66. 85 [153]"letter, digit, symbol, etc.  atn 'file'
  67. 86 print"is a set of bytes grouped together and
  68. 87 [153]"given a name.  atn file can be a peekatn(NULL)right$len,
  69. 88 print"[195][207][205][193][204][160]or [205]achine [204]anguage program, or
  70. 89 [153]"a graphics picture, a set of sprite
  71. 90 print"shapes, a list of names and phone "
  72. 91 print"numbers, or any other set of data.":gosub1200
  73. 95 print"   [194]efore a disk can be used to hold
  74. 96 [153]"files, it must be 'formatted'.  (NULL)his
  75. 97 print"usually only needs to be done once.
  76. 98 [153]"atnmong other things, the formatting
  77. 99 print"process gives the disk a 'name' and an
  78. 100 [153]"'right$.str$.'.  (NULL)he right$.str$. is two characters,
  79. 101 print"cannot contain a ,[146] or =[146], and must
  80. 102 [153]"be different for each disk you own.
  81. 103 print"[212]he disk name (and file names, too)
  82. 104 [153]"may be up to 16 characters long with
  83. 105 print"no ,[146], =[146], ?[146], or *[146], and may not
  84. 106 [153]"begin with a #wait or a $wait!":[141]1200
  85. 110 [153]"   ascormatting a disk is accomplished
  86. 111 print"by the disk drive itself, not the [195]64!
  87. 112 [153]"right$n other words, you simply (NULL)atn(NULL)(NULL) a "
  88. 113 [153]"command to the disk drive, and it does
  89. 114 print"the work!  [201]n [194][193][211][201][195], this is a tedious
  90. 115 [153]"and involved process.  right$n len(NULL)(NULL)atn(NULL), the
  91. 116 print"[208][193][211][211] statement makes it easy!  [202]ust
  92. 117 [153]"think of (NULL)atn(NULL)(NULL) as a (NULL)(NULL)right$(NULL)(NULL) to the disk
  93. 118 print"drive's 'command channel'.  [193]ny disk
  94. 119 [153]"drive command can be (NULL)atn(NULL)(NULL)ed!
  95. 120 :
  96. 121 gosub1200
  97. 125 print"   [217]our disk drive's manual tells you
  98. 126 [153]"that to format a disk, the 'command
  99. 127 print"channel' must be given a [206][197][215] command.
  100. 128 [153]"(NULL)ike all disk drive 'command channel'
  101. 129 print"commands, this one begins with a "
  102. 130 print"single letter (in this case, [206] for"
  103. 131 print"[206][197][215]), followed by an optional drive"
  104. 132 print"number (either none or 0 unless you"
  105. 133 print"have a dual-drive unit), plus a :[146],"
  106. 134 print"followed by parameters.  [212]he "
  107. 135 print"parameters for the [206][197][215] command are"
  108. 136 print"the [206][193][205][197] and [201][196] for the new disk.":gosub1200
  109. 140 print"   [211]o, a [206][197][215][160]command to give our disk
  110. 141 [153]"the name 'len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1' and an right$str$"
  111. 142 [153]"of 'len1', would be:"
  112. 143 [153]"   '(NULL)0:len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1,len1'.
  113. 144 :
  114. 145 :
  115. 146 :
  116. 147 :
  117. 148 print"   [211]o how do we get this command to
  118. 149 [153]"the disk drive's 'command channel'?
  119. 150 print"[215]ith [195][207][205][193][204]'s [208][193][211][211] statement!":gosub1200
  120. 155 print"   [215]e simply type '[208][193][211][211]', followed by
  121. 156 [153]"the command enclosed within double-
  122. 157 print"quotes.  [206]ow type:"
  123. 158 print"   [208][193][211][211] "q$"[206]0:[195][207][205][193][204][160][208][210][207][199][210][193][205][211]#1,[195]1"q$"
  124. 159 [153]" (str$on't worry..we're (NULL)(NULL)(NULL) going to ":[153]"         (NULL)val(NULL)closeyour disk!)
  125. 160 gosub1160:gosub1300:x%=.:y%=24:a$="[208][193][211][211] "+q$+"[206]0:[195][207][205][193][204] [208][210][207][199][210][193][205][211]#1,[195]1"+q$:gosub1600
  126. 161 ifethena$=mid$(a$,e):e=.:gosub1605:goto161
  127. 162 x%=29:y%=24:gosub1500:ifk$<>chr$(13)then162
  128. 163 gosub1700:gosub1700
  129. 165 gosub1035:gosub1150:gosub1220:print"[144][146][196]one!  [206]ow check status by typing:"
  130. 166 print"   [211][212][193][212][213][211]
  131. 170 [141]1160:x%[178].:y%[178]24:a$[178]"(NULL)(NULL)atn(NULL)(NULL)(NULL)":[141]1600
  132. 171 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]171
  133. 172 x%[178]6:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]172
  134. 173 [141]1700:[153]"00, (NULL)(NULL),00,00";:[141]1700:[141]1700
  135. 175 [141]1035:[141]1150:[153]"stopwait(NULL)ure looks '(NULL)(NULL)' to me!":[141]1205
  136. 180 [153]"   atnfter formatting a disk, we need"
  137. 181 [153]"not do so again.  (NULL)e can save up to"
  138. 182 [153]"144 programs on it!"
  139. 183 :
  140. 184 [153]"   (NULL)o save the current len(NULL)(NULL)atn(NULL) program
  141. 185 print"in memory as a disk file, use [195][207][205][193][204]'s
  142. 186 [153]"'(NULL)atn(NULL)val' command.  (NULL)e simply type '(NULL)atn(NULL)val'
  143. 187 print"followed by our desired file name "
  144. 188 print"enclosed in double-quotes!  [210]emember,"
  145. 189 print"a file name, like a disk name, may be"
  146. 190 print"up to 16 characters long.":gosub1200
  147. 195 print"   [211]ince file names may not contain"
  148. 196 print"a ,[146], =[146], ?[146], or *[146], and may not"
  149. 197 print"begin with a #[146] or $[146], let's call"
  150. 198 print"our program '[195].[195][197][204][211][201][213][211] #1'.  [212]o save"
  151. 199 print"it under our chosen name, type:"
  152. 200 print"   [211][193][214][197] "q$"[195].[195][197][204][211][201][213][211] #1"q$"
  153. 205 [141]1160:[141]1300:x%[178].:y%[178]24:a$[178]"(NULL)atn(NULL)val "[170]q$[170]"len.lenval(NULL)(NULL)right$(NULL)(NULL) #1"[170]q$:[141]1600
  154. 206 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]206
  155. 207 x%[178]19:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]207
  156. 208 [141]1700:[141]1700:[159]8,8,8,"c.celsius #1,p,w"
  157. 209 [135]d%:[139]d%[177][178]0[167][152]8,[199](d%);:[137]209
  158. 210 [160]8:[141]1035:[141]1150:[153]"waitstop   (NULL)here!  (NULL)ow that our program has
  159. 211 print"been placed safely on our disk, let's
  160. 212 [153]"clear out len(NULL)(NULL)atn(NULL)'s program memory (i.e.
  161. 213 print"erase our program from memory).":gosub1205
  162. 215 print"   [212]o do this, we need to use [195][207][205][193][204]'s
  163. 216 [153]"'(NULL)val(NULL)' command (not to be confused with
  164. 217 print"the disk drive's '[206][197][215]').  [212]he [195][207][205][193][204]
  165. 218 [153]"'(NULL)val(NULL)' command erases the program in":[153]"memory.  right$t does (NULL)(NULL)(NULL)";
  166. 219 [153]"affect the diskdrive.":[153]"   atnfter a '(NULL)val(NULL)',";
  167. 220 [153]"there is no len(NULL)(NULL)atn(NULL)":[153]"program in memory.
  168. 221 print"[204]et's try it.  [212]ype:
  169. 222 [153]"   (NULL)val(NULL)"
  170. 225 [141]1160:[141]1300:x%[178].:y%[178]24:a$[178]"(NULL)val(NULL)":[141]1600
  171. 226 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]226
  172. 227 x%[178]3:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]227
  173. 228 [141]1700:[141]1700:[141]1035:[141]1150:[158]wi
  174. 229 [153]"stopwait(NULL)kay, program memory is now cleared."
  175. 230 [153]"(NULL)et's be sure.  (NULL)ry the (NULL)right$(NULL)(NULL) command:"
  176. 231 :
  177. 235 [141]1160:[141]1300:x%[178].:y%[178]24:a$[178]"(NULL)right$(NULL)(NULL)":[141]1600
  178. 236 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]236
  179. 237 x%[178]4:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]237
  180. 238 [141]1700:[141]1700:[141]1035:[141]1150
  181. 240 [153]"stopwait   left$mmm... not much there, is there?
  182. 241 print"[206]ow try to [210][213][206][160]our program:
  183. 245 [141]1160:x%[178].:y%[178]24:a$[178]"(NULL)(NULL)(NULL)":[141]1600
  184. 246 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]246
  185. 247 x%[178]3:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]247
  186. 248 [141]1700:[141]1700:[141]1035:[141]1150
  187. 250 [153]"stopwait   (NULL)till nothing!  right$ guess our program
  188. 251 print"is gone forever!
  189. 252 [153]"   str$on't panic!  (NULL)here is (NULL)(NULL)right$(NULL)(NULL) our
  190. 253 print"trusty little disk drive.  [194]ut how do
  191. 254 [153]"we get a program from it into len(NULL)(NULL)atn(NULL)?":[141]1205
  192. 255 [153]"   ascirst, let's check the contents of
  193. 256 print"the disk.  [197]ach disk has a list of the
  194. 257 [153]"files that are on it, which it keeps
  195. 258 print"in a special part of the disk called
  196. 259 [153]"the 'catalog' (or 'directory').  (NULL)o
  197. 260 print"see it, use the '[195][193][212]' command:
  198. 261 [141]1160:[141]1300:x%[178].:y%[178]24:a$[178]"lenatn(NULL)":[141]1600
  199. 262 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]262
  200. 263 x%[178]3:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]263
  201. 264 [159]15,8,15:[159]8,8,8,"#":[152]15,"u1:8 0 18 0":[141]1700:[153]"on
  202. 265 print" 0 [146]"q$"[195][207][205][193][204][160][208][210][207][199][210][193][205][211]#1"q$" [195]1 2[193]";:gosub1700:print"[145]
  203. 266 [152]15,"ua:8 0 18 1"
  204. 267 [153]" 1    "q$"len.lenval(NULL)(NULL)right$(NULL)(NULL)close#1"q$"     (NULL)(NULL)chr$";:[141]1700:[153]"on
  205. 268 print" 663 blocks free.";:gosub1700:gosub1700
  206. 269 close8:close15:gosub1035:gosub1150
  207. 271 print"[144][146]   [212]he top line (in [210][197][214][197][210][211][197][146]) tells us
  208. 272 [153]"that the catalog is from the disk in
  209. 273 print"drive #0 (the 1541 only has 1 drive!),
  210. 274 [153]"called 'len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1' with an right$str$
  211. 275 print"of '[195]1'.  [211]ound familiar?":gosub1205
  212. 276 print"   [196]on't worry about the '2[193]'.  [201]t
  213. 277 [153]"simply means that the disk is in 1541-
  214. 278 print"compatible format.  [212]he next line is
  215. 279 [153]"even more interesting!  right$t tells us we
  216. 280 print"have a 1 'block' file by the name of
  217. 281 [153]"'len.lenval(NULL)(NULL)right$(NULL)(NULL)close#1',  and that said file is
  218. 282 print"a [208][210]o[199]ram!  [206]ow you know why [201] had us
  219. 283 [153]"start our file name with 'len.'.  (NULL)here
  220. 284 print"is no way to tell from the catalog "
  221. 285 print"alone whether a [208][210][199] is [194][193][211][201][195], machine-
  222. 286 [153]"language or len(NULL)(NULL)atn(NULL)!":[141]1200
  223. 290 [153]"   (NULL)he last line tells us that we
  224. 291 print"still have 663 'blocks' left on the
  225. 292 [153]"disk.  atn 'block'closeis simply the "
  226. 293 [153]"smallest 'chunk' of space that can be"
  227. 294 [153]"allocated by the disk drive.  atn block
  228. 295 print"holds just over 250 bytes.  [207]ur "
  229. 296 print"program, being quite small, took up"
  230. 297 print"only one block!
  231. 298 [153]"   (NULL)kay, we know our program is on the
  232. 299 print"disk.  [200]ow do we load it back into the
  233. 300 [153]"64's memory?  (NULL)ith the '(NULL)(NULL)atnstr$' command!":[141]1200
  234. 301 [153]"   len(NULL)(NULL)atn(NULL)'s '(NULL)(NULL)atnstr$' command is similar
  235. 302 print"to the related [211][193][214][197] command.  [207]ne "
  236. 303 print"simply types '[204][207][193][196]' followed by the "
  237. 304 print"file name of the program to [204][207][193][196] "
  238. 305 print"enclosed in double-quotes.  [217]ou try"
  239. 306 print"it.  [212]ype:
  240. 307 [153]"   (NULL)(NULL)atnstr$ "q$"len.lenval(NULL)(NULL)right$(NULL)(NULL) #1"q$"
  241. 310 gosub1160:gosub1300:x%=.:y%=24:a$="[204][207][193][196] "+q$+"[195].[195][197][204][211][201][213][211] #1"+q$:gosub1600
  242. 311 ifethena$=mid$(a$,e):e=.:gosub1605:goto311
  243. 312 x%=19:y%=24:gosub1500:ifk$<>chr$(13)then312
  244. 313 gosub1700:gosub1700:open8,8,.,"c.celsius #1"
  245. 314 get#8,a$:ifst=.then314
  246. 315 close8:gosub1035:gosub1150:print"[144][146][199]ood!  [206]ow [204][201][211][212][160]it:
  247. 320 [141]1160:x%[178].:y%[178]24:a$[178]"(NULL)right$(NULL)(NULL)":[141]1600
  248. 321 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]321
  249. 322 x%[178]4:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]322
  250. 323 [141]1700:[153]"0010 right$(NULL)(NULL)(NULL)(NULL) "q$"str$valchr$(NULL)valval(NULL) asc? "q$": ascatn(NULL)val(NULL)left$valright$(NULL)";:[141]1700:[153]"on
  251. 324 print"0020 [195][197][204][211][201][213][211]:=([198][193][210][197][206][200][197][201][212]-32)*(5/9)";:gosub1700:print"[145]
  252. 325 [153]"0030 (NULL)(NULL)right$(NULL)(NULL) ascatn(NULL)val(NULL)left$valright$(NULL);"q$"asc ="q$";lenval(NULL)(NULL)right$(NULL)(NULL);"q$"len"q$;:[141]1700:[141]1700
  253. 326 [141]1035:[141]1150:[153]"stopwait(NULL)eems to be all there!":[141]1205
  254. 330 [153]"   (NULL)(NULL)(NULL) it once to make sure.  left$ave it
  255. 331 print"convert 32 degrees [198]arenheit to "
  256. 332 print"degrees [195]elsius:"
  257. 335 gosub1160:gosub1300:x%=.:y%=24:a$="[210][213][206]":gosub1600
  258. 336 ifethena$=mid$(a$,e):e=.:gosub1605:goto336
  259. 337 x%=3:y%=24:gosub1500:ifk$<>chr$(13)then337
  260. 338 gosub1700:print"[145]":print"[196][197][199][210][197][197][211] [198]? ";:
  261. 339 x%=11:y%=24:a$="32":gosub1600
  262. 340 ifethena$=mid$(a$,e):e=.:gosub1605:goto340
  263. 341 x%=13:y%=24
  264. 342 gosub1500:ifk$<>chr$(13)then342
  265. 343 gosub1700:print"32 [198] = 0 [195][145]";:gosub1700
  266. 344 gosub1700:print"[197][206][196][160][193][212][160]0030";:gosub1700:gosub1700
  267. 345 gosub1035:gosub1150:print"[144][146][211]o water freezes at 0 [195] (32 [198])!
  268. 346 [153]"   (NULL)e have learned quite a lot of very
  269. 347 print"important stuff today!
  270. 348 [153]"   1.  left$ow to (NULL)atn(NULL)(NULL) a (NULL)val(NULL) command to
  271. 349 print"disk drive in order to format a [206][197][215]
  272. 350 [153]"disk, giving it a name and right$str$.":[141]1205
  273. 351 [153]"   2.  left$ow to (NULL)atn(NULL)val a len(NULL)(NULL)atn(NULL) program to
  274. 352 print"the disk a file, by file name.
  275. 354 [153]"   3.  left$ow to clear out len(NULL)(NULL)atn(NULL) memory,
  276. 355 print"in preparation for typing in a '[206][197][215]'
  277. 356 [153]"program.
  278. 357 print"   4.  [200]ow to display and understand
  279. 358 [153]"the lenatn(NULL)alog of a disk.
  280. 359 print"   5.  [200]ow to [204][207][193][196] a previously-[211][193][214][197]d
  281. 360 [153]"program into memory from disk.":[141]1200
  282. 361 [153]"   (NULL)ell, it's that time again.  (NULL)ime
  283. 362 print"for a short quiz to check up on "
  284. 363 print"concepts taught this lesson.  [193]s "
  285. 364 print"usual the questions are either true-"
  286. 365 print"false or multiple-choice.  [217]our "
  287. 366 print"possible answers will be hilighted in"
  288. 367 print"reverse[146].  [202]ust press the correct key.":gosub1200
  289. 370 print"1.  [194]efore you can use a new, blank
  290. 371 [153]"disk, you must first:
  291. 372 print"    [193] [146]  [201]nitialize it,
  292. 373 [153]"    peek wait  ascormat it,
  293. 374 print"    [195] [146]  [206]ame and [201][196] it, or
  294. 375 [153]"    str$ wait  peekoth peek and len.
  295. 376 gosub1300:a$="[196]":w1$="[193]":w2$="[194]":w3$="[195]":gosub1800
  296. 377 print"[193] new disk must be"
  297. 378 print"formatted and given a name and [201][196].":gosub1205
  298. 380 print"2.  [212]o format a new disk and give it
  299. 381 [153]"a name and right$str$ from len(NULL)(NULL)atn(NULL), type:
  300. 382 print"    [193] [146]  [207][208][197][206] 15,8,15,"q$"[206]0:diskname,id"q$
  301. 383 print"    [194] [146]  [208][193][211][211] "q$"[206]0:diskname,id"q$
  302. 384 print"    [195] [146]  [198][207][210][205][193][212] 0,"q$"diskname"q$","q$"id"q$
  303. 385 print"    [196] [146]  [206]one of the above.
  304. 386 [141]1300:a$[178]"peek":w2$[178]"str$":[141]1800:[153]"len(NULL)(NULL)atn(NULL)'s '(NULL)atn(NULL)(NULL)' statement
  305. 387 print"is used to pass [206]<ew>, or any other
  306. 388 [153]"disk drive command to the drive.":[141]1205
  307. 390 [153]"3.  atn disk usually needs to be (NULL)val(NULL)ed
  308. 391 print"only once.  [212]he [195][207][205][193][204] program in "
  309. 392 print"memory can be written to a disk with"
  310. 393 print"sufficient room by using:
  311. 394 [153]"    atn wait  the '(NULL)atn(NULL)val'closecommand,
  312. 395 print"    [194] [146]  the '[215][210][201][212][197]' command,
  313. 396 [153]"    len wait  the '(NULL)(NULL)(NULL)(NULL)val' command, or
  314. 397 print"    [196] [146]  the '[212][193][203][197][160][212][200][193][212]!' command.
  315. 398 [141]1300:a$[178]"atn":w1$[178]"peek":[141]1800:[153]"(NULL)he '(NULL)atn(NULL)val' command writes,
  316. 399 print"or saves, a [195][207][205][193][204] program.":gosub1205
  317. 400 print"4.  [212]o clear the [195][207][205][193][204][160]program memory
  318. 401 [153]"space, use:
  319. 402 print"    [193] [146]  the '[195][204][197][193][210]' command.
  320. 403 [153]"    peek wait  the 'val(NULL)atn(NULL)val'closecommand.
  321. 404 print"    [195] [146]  the '[206][197][215]' command, or
  322. 405 [153]"    str$ wait  the 'lenatn(NULL)' command.
  323. 406 gosub1300:a$="[195]":w3$="[193]":gosub1800:print"[212]he [206][197][215][160]command clears the
  324. 407 [153]"len(NULL)(NULL)atn(NULL)closeprogram space, usually so you
  325. 408 print"can start typing in a [206][197][215] program.":gosub1205
  326. 410 print"5.  [212]o find out what is on a disk,
  327. 411 [153]"just use:
  328. 412 print"    [193] [146]  the '[204][201][211][212]' command,
  329. 413 [153]"    peekclosewait  the '(NULL)atn(NULL)(NULL)close"q$"$"q$"' command,
  330. 414 print"    [195] [146]  the '[206][197][215]' command, or
  331. 415 [153]"    str$ wait  the 'lenatn(NULL)' command.
  332. 416 gosub1300:a$="[196]":w2$="[195]":gosub1800:print"[212]o see what is on the disk
  333. 417 [153]"you have to look at its lenatn(NULL)alog.  (NULL)he
  334. 418 print"[195][207][205][193][204][160]'[195][193][212]' command displays said "
  335. 419 print"[195][193][212]alog.":gosub1205
  336. 420 print"6.  [212]o retrieve a [195][207][205][193][204] program that
  337. 421 [153]"was (NULL)atn(NULL)vald to disk, use:
  338. 422 print"    [193] [146]  the '[197][206][212][197][210]' command,
  339. 423 [153]"    peek wait  the '(NULL)(NULL)str$'closecommand,
  340. 424 print"    [195] [146]  the '[204][207][193][196]' command, or
  341. 425 [153]"    str$ wait  the 'chr$val(NULL)closeright$(NULL)closeleft$val(NULL)val!' command.
  342. 426 gosub1300:a$="[195]":w2$="[196]":gosub1800:print"[217]ou [204][207][193][196] a program into
  343. 427 [153]"memory that was (NULL)atn(NULL)vald to disk!":[141]1205
  344. 430 [153]"7.  (NULL)hich of the following is a legal
  345. 431 print"file name?
  346. 432 [153]"    atn wait  'len.(NULL)left$atn(NULL)closeatnclose(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)!'
  347. 433 print"    [194] [146]  '[195][207][205][193][204][160][208][210][199][160]#1'
  348. 434 [153]"    len wait  '#1 len(NULL)(NULL)atn(NULL)close(NULL)(NULL)chr$'
  349. 435 print"    [196][160][146]  '[195][207][205][193][204][160][208][210][199], [206][207]. 1'
  350. 436 [141]1300:a$[178]"peek":w1$[178]"len":[141]1800:[153]"(NULL)emember, a file name can
  351. 437 print"[206][207][212][160]have more than 16 characters (like
  352. 438 [153]"atn), start with '#' or '$'close(like len) nor
  353. 439 print"contain ,[146], =[146], ?[146], or *[146] (like [196]).
  354. 440 [141]1205
  355. 445 [153]"8.  '* len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)ascascclose*' is a legal disk
  356. 446 print"name, but an illegal file name.
  357. 447 [153]"    (NULL) waitrue or  asc waitalse?
  358. 448 gosub1300:a$="[212]":w1$="[198]":w2$="[198]":w3$="[198]":gosub1800
  359. 449 print"[212]he characters ?[146] and *[146]
  360. 450 [153]"are okay in disk names, but illegal in
  361. 451 print"file names.":gosub1205
  362. 455 print"9.  [201]t is in your best interests to
  363. 456 [153]"give each disk you format the same right$str$.
  364. 457 print"    [212] [146]rue or  [198] [146]alse
  365. 458 [141]1300:a$[178]"asc":w1$[178]"(NULL)":w2$[178]"(NULL)":w3$[178]"(NULL)":[141]1800
  366. 459 [153]"(NULL)he right$str$closeis what the drive
  367. 460 print"uses to see if you have the same disk
  368. 461 [153]"in the drive before (NULL)atn(NULL)valing or other
  369. 462 print"writing.  [201]f two [201][196]'s are the same,
  370. 463 [153]"the drive might write over space that
  371. 464 print"was free on the [207][212][200][197][210] disk!":gosub1205
  372. 465 print"10.  [212]he '[195].' of '[195].[195][197][204][211][201][213][211][160]#1', our
  373. 466 [153]"program's file name, tells the drive
  374. 467 print"that it is a [195][207][205][193][204] program.
  375. 468 [153]"    (NULL)closewaitrue or  asc waitalse?
  376. 469 gosub1300:gosub1800:print"[201]t tells [213][211][160]that it is a
  377. 470 [153]"len(NULL)(NULL)atn(NULL) program, when we read the"
  378. 471 [153]"lenatn(NULL)alog.  (NULL)he disk drive doesn't need"
  379. 472 [153]"to know!":[141]1205
  380. 550 [153]"   (NULL)hat is all for this issue.  (NULL)f the
  381. 551 print"10 questions in our little quiz, you
  382. 552 [153]"answered"sc%"correctly.
  383. 553 ifsc%<10then560
  384. 554 print"   [201][160]know a perfect score when [201] see
  385. 555 [153]"one!  (NULL)ou are definitely ready for
  386. 556 print"next issue's lesson!":goto600
  387. 560 ifsc%<7then570
  388. 561 print"   [217]ou did rather well!  [201] suggest you
  389. 562 [153]"obtain a copy of len(NULL)(NULL)atn(NULL) 0.14 (if you
  390. 563 print"do not have one already) and practice
  391. 564 [153]"the concepts taught this lesson.  (NULL)ou
  392. 565 print"will then be ready for next issue's
  393. 566 [153]"lesson.":[137]600
  394. 570 [153]"   (NULL)ou do not seem to have caught on
  395. 571 print"to many of the concepts presented this
  396. 572 [153]"lesson.  (NULL)e-take this tutorial, then":[137]562
  397. 600 [153]vt$(15)"clr (NULL)ress space bar to return to (NULL)oadstar! ":[141]1300:[151]198,.:[146]198,1
  398. 601 [151]198,.:[141]1400:[151]v[170]33,.:[153]"loadstopload"q$"hello"q$",8":[153]"run"
  399. 605 [151]631,13:[151]632,13:[151]198,2
  400. 999 [128]:
  401. 1000 [151]v[170]33,1:[153]"load len(NULL)(NULL)atn(NULL)close0.14 (NULL)utorial     right$nstallment #3"
  402. 1005 [153]"stoportantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantan^";:[129]i[178]1[164]12
  403. 1010 [153]"(NULL)                                      (NULL)";:[130]:
  404. 1015 [153]"/tantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantantanexp
  405. 1020 printvtab$(14):fori=1to9:print"                                        ";
  406. 1025 next:gosub1050
  407. 1030 fori=217to242:pokei,peek(i)or128:next:
  408. 1035 poke1020,2:poke1021,13:poke1022,1:poke1023,38:return:
  409. 1050 printvt$(24)"                                       [146]";           
  410. 1055 poke2023,160:poke56295,6:return:
  411. 1100 gosub1160
  412. 1110 printvt$(y%-1):printtab(x%);:return:
  413. 1150 x%=sx%:y%=sy%:goto1110
  414. 1160 sx%=peek(211):sy%=peek(214):return:
  415. 1200 gosub1300
  416. 1205 printvt$(14):printtab(3)"[129]  [208]ress space bar for next page.  "
  417. 1210 poke198,.:wait198,1:poke198,.
  418. 1215 printvt$(14):printtab(3)"                                  "
  419. 1220 goto1400
  420. 1300 poke646,15:waitr,c:waitr,c:syscl:poke646,12:waitr,c:waitr,c:syscl
  421. 1305 poke646,11:waitr,c:waitr,c:syscl:poke646,.:waitr,c:waitr,c:syscl:return:
  422. 1400 poke646,11:waitr,c:waitr,c:syscl:poke646,12:waitr,c:waitr,c:syscl
  423. 1405 poke646,15:waitr,c:waitr,c:syscl:waitr,c:waitr,c:syswi:return:
  424. 1500 gosub1110:f%=-1:l%=peek(209)+256*peek(210)+peek(211):c%=peek(l%)
  425. 1505 pokel%,-f%*(peek(l%)and127)-(notf%)*(peek(l%)or128):f%=notf%
  426. 1510 forf=1to48:getk$:ifk$=""thennext:goto1505
  427. 1512 ifk$="[160]"thenk$=" ":rem shift-space to space!
  428. 1515 f=256:next:pokel%,c%:ifk$>"@"andk$<"["thenk$=chr$(asc(k$)+128)
  429. 1520 return:
  430. 1600 ax%=x%:ay%=y%
  431. 1605 fora=1tolen(a$)
  432. 1606 gosub1500:ifk$=mid$(a$,a,1)thenprint""k$;:poke212,.:poke216,.:x%=x%+1:next:return:
  433. 1607 ifk$=chr$(13)then1606
  434. 1610 e=a:e$=mid$(a$,e,1):a=256:next:
  435. 1615 print"";:poke212,1:poke216,1:printk$;:poke212,.:poke216,.:gosub1150
  436. 1620 pokev+32,2:print"[207][207][208][211]!  [217]ou missed the [150] "e$"  key!":gosub1900:gosub1150
  437. 1625 pokev+32,5:print"[206]ow press the [153] [201][206][211][212]-[196][197][204]  key once:  ":x%=ax%+e:y%=ay%
  438. 1630 gosub1500:ifk$<>""then1630
  439. 1635 gosub1150:pokev+32,14:print"[154][206]ow finish typing![146]                    "
  440. 1640 ax%=ax%+e-1:x%=ax%:y%=ay%:return:
  441. 1700 poke1020,16:poke1021,24:poke1022,.:poke1023,39
  442. 1705 syssu:gosub1050:x%=.:y%=24:goto1110:
  443. 1800 gosub1160
  444. 1805 x%=.:y%=24:gosub1500:ifk$<>a$andk$<>w1$andk$<>w2$andk$<>w3$then1805
  445. 1810 gosub1035:gosub1150:print:
  446. 1815 ifk$=a$thenprint" [195][207][210][210][197][195][212]! [146][144]  ";:sc%=sc%+1:return:
  447. 1820 print" [211]orry. [146][144]  ";:return:
  448. 1900 forp=1to2048:next:return:
  449. 9000 data69,,79,,98,,,10,22,181,3,11,68,69,71,82,69,69,83,32,70,63,32,183,7,1
  450. 9005 data184,187,,20,22,7,2,4,1,2,,32,41,71,2,,5,2,,9,35,71,36,58,,30,25,95,4,1
  451. 9010 data100,103,3,3,70,32,61,101,103,4,2,100,103,3,1,67,101,96,97,16,252,175,,
  452. 9015 data16,247,175,,,9,70,65,82,69,78,72,69,73,84,7,67,69,76,83,73,85,83,,,-1
  453.